<?php
class SleekBase_NakedDayModule extends Module {
	public function run () {
		# If it's naked day - clear scripts and styles from Base
		if ($this->isNakedDay()) {
			$this->setData('styles', array(), 'Base');
			$this->setData('scripts', array(), 'Base');
			$this->setData('scripts_head', array(), 'Base');
		}
		# Otherwise don't show the naked day info
		else {
			$this->setView(false);
		}
	}

	public function isNakedDay ($d = 4) {
		$start	= date('U', mktime(-12, 0, 0, 04, $d, date('Y')));
		$end	= date('U', mktime(36, 0, 0, 04, $d, date('Y')));
		$z		= date('Z') * -1;
		$now	= time() + $z;

		if ($now >= $start && $now <= $end) {
			return true;
		}

		return false;
	}
}
